<?php
/**
 * Group index
 * หน้าจัดการ group
 * @package Member
 * @subpackage View
 * @category view
 */
require('right_bar.php');
$x['AddTitle'] .= $this->lang->line('member.120.groupmanagement');

/* Load CSS */
$tmp = array('a:c:validationEngine.jquery', 'a:c:form_signup', 'a:c:excite-bike:jqui184', 'a:c:table-style','a:c:fancybox134');
$x['AddHead'] .= $this->bee->AddCss($tmp);
unset($tmp);
// Load CSS
/* Load JavaScript*/
$tmp = array('a:j:jquery.validationEngine-en', 'a:j:jquery.validationEngine','a:j:fancybox134.pack');
$bf['AddFoot'] .= $this->bee->AddJava($tmp);
unset($tmp);
// Load JavaScript 

$x['AddCss'] .= '
.permanent{
    background-color:#FFCC66;
}
input[type=submit]{
    margin-left: 170px;
}';
$bf['AddHeadJquery'] .= '
    $(".bbox").fancybox({
    "width" : 680
    });
    $(".bbox2").fancybox({
    "width" : 680

    });
     $(".form_blue").validationEngine();
     ';

$x['headlink'] = $this->lang->line('member.120.groupmanagement');

$this->admin->view('_head', $x);
unset($x);
?>
<div id="rightnow">
    <h3 class="reallynow">
        <span><?php echo $this->lang->line("member.120.groupmanagement");?></span>
        <!--<?php echo anchor( '#addgroup' , $this->lang->line("member.121.addgroup") ,'class="bsp bicon s-add bbox"' ,false );?>-->
        <a href="#addgroup" class="bsp bicon s-add bbox"><?php echo $this->lang->line("member.121.addgroup")?></a>


        <br />
    </h3>
    <p class="youhave"></p>

</div>
<h2><?php echo $this->lang->line('member.125.currentgroup')?></h2>
<table class="btable">
    <thead>
        <tr>
        <th><?php echo $this->lang->line('member.122.permission');?></th>
        <th><?php echo $this->lang->line('member.124.groupname');?></th>
        <th><?php echo $this->lang->line('member.126.action');?></th>
        </tr>
    </thead>
    <tbody><?php
        foreach($group->result() as $k){

            ?>
        <tr<?php if($k->permanent) echo ' class="permanent"';?>>
            <td><?php echo $k->value?></td>
            <td><?php echo $k->group_name?></td>
            <td><?php if(!$k->permanent){
                echo anchor('member/admin/delete_group/'.$k->id,$this->lang->line('member.127.delete'),'class="bsp bicon s-cancel" onclick="javascript:return confirm(\''.$this->lang->line("member.128.confirmdel").'\')"');
            }?>
                <?php echo anchor(site_url('member/admin/view_group_member/'.$k->value),$this->lang->line('member.129.viewmember'),'class="bsp bicon s-zoom bbox2 iframe"') ?>
            </td>
        </tr>
        <?php
        }
        ?>

    </tbody>
</table>
<div style="display:none;">
<div id="addgroup">
    <form action="<?php echo site_url('member/admin/add_group/')?>" method="post" class="form_blue">
        <p><?php echo $this->lang->line('member.123.permissiondetail')?></p>
        <fieldset>
            <legend><?php echo $this->lang->line('member.121.addgroup');?></legend>
            <div><label for="group_name"><?php echo $this->lang->line('member.124.groupname');?></label>
            <input type="text" name="group_name" id="group_name" class="validate[required]" /></div>
            <div><label for="value"><?php echo $this->lang->line('member.122.permission');?></label>
            <input type="text" name="value" id="value" class="validate[required,custom[onlyNumber]]" /></div>
            <input type="submit" name="submit" value="<?php echo $this->lang->line('member.121.addgroup')?>" />
        </fieldset>
    </form>
</div>
    </div>
<?php
$this->admin->view('_foot', $bf);
unset($bf);
?>